package gestionTransportObjetsGenerated;

/**
 * Interface definition : GestionOperateur
 * 
 * @author OpenORB Compiler
 */
public abstract class GestionOperateurPOA extends org.omg.PortableServer.Servant
        implements GestionOperateurOperations, org.omg.CORBA.portable.InvokeHandler
{
    public GestionOperateur _this()
    {
        return GestionOperateurHelper.narrow(_this_object());
    }

    public GestionOperateur _this(org.omg.CORBA.ORB orb)
    {
        return GestionOperateurHelper.narrow(_this_object(orb));
    }

    private static String [] _ids_list =
    {
        "IDL:gestionTransportObjetsGenerated/GestionOperateur:1.0"
    };

    public String[] _all_interfaces(org.omg.PortableServer.POA poa, byte [] objectId)
    {
        return _ids_list;
    }

    public final org.omg.CORBA.portable.OutputStream _invoke(final String opName,
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler)
    {

        if (opName.equals("_get_nom")) {
                return _invoke__get_nom(_is, handler);
        } else if (opName.equals("accepterTransport")) {
                return _invoke_accepterTransport(_is, handler);
        } else if (opName.equals("informerBesoinTransport")) {
                return _invoke_informerBesoinTransport(_is, handler);
        } else if (opName.equals("notifierDepotTransp")) {
                return _invoke_notifierDepotTransp(_is, handler);
        } else if (opName.equals("obtenirStations")) {
                return _invoke_obtenirStations(_is, handler);
        } else if (opName.equals("verifierCodeTransport")) {
                return _invoke_verifierCodeTransport(_is, handler);
        } else {
            throw new org.omg.CORBA.BAD_OPERATION(opName);
        }
    }

    // helper methods
    private org.omg.CORBA.portable.OutputStream _invoke__get_nom(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        String arg = nom();
        _output = handler.createReply();
        _output.write_string(arg);
        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_informerBesoinTransport(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        gestionTransportObjetsGenerated.TransportColis arg0_in = gestionTransportObjetsGenerated.TransportColisHelper.read(_is);

        informerBesoinTransport(arg0_in);

        _output = handler.createReply();

        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_accepterTransport(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        gestionTransportObjetsGenerated.TransportColis arg0_in = gestionTransportObjetsGenerated.TransportColisHelper.read(_is);

        String _arg_result = accepterTransport(arg0_in);

        _output = handler.createReply();
        _output.write_string(_arg_result);

        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_verifierCodeTransport(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        String arg0_in = _is.read_string();

        gestionTransportObjetsGenerated.TransportColis _arg_result = verifierCodeTransport(arg0_in);

        _output = handler.createReply();
        gestionTransportObjetsGenerated.TransportColisHelper.write(_output,_arg_result);

        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_notifierDepotTransp(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        gestionTransportObjetsGenerated.TransportColis arg0_in = gestionTransportObjetsGenerated.TransportColisHelper.read(_is);

        notifierDepotTransp(arg0_in);

        _output = handler.createReply();

        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_obtenirStations(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        String arg0_in = _is.read_string();
        gestionTransportObjetsGenerated.TransportColisHolder arg1_out = new gestionTransportObjetsGenerated.TransportColisHolder();

        try
        {
            obtenirStations(arg0_in, arg1_out);

            _output = handler.createReply();

            gestionTransportObjetsGenerated.TransportColisHelper.write(_output,arg1_out.value);
        }
        catch (gestionTransportObjetsGenerated.COLIS_INCONNU _exception)
        {
            _output = handler.createExceptionReply();
            gestionTransportObjetsGenerated.COLIS_INCONNUHelper.write(_output,_exception);
        }
        return _output;
    }

}
